// https : // iai.sh.cn/problem/928
#include <bits/stdc++.h>

        using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int c = 0; // 进位
  while (a > 0 || b > 0) {
    int g1 = a % 10;
    int g2 = b % 10;
    if (g1 + g2 + c >= 10) {
      ans++;
      c = 1;
    } else
      c = 0;
      
    a = a / 10;
    b = b / 10;
  }
  cout << ans;

  return 0;
}